package com.kangnam.mongo;

public class ProduceIdGenerator {
	private static ProduceIdGenerator obj = null;
	
	private String currentId = "";
	
	private static long currentNum = 0;
	
	ProduceIdGenerator () 
	{
		
	}
	
	public synchronized ProduceIdGenerator getInstance()
	{
		if(obj == null) 
		{
			obj = new ProduceIdGenerator();
		}
		
		return obj;
	}
	
	public String getId()
	{		
		long date = System.currentTimeMillis();	
		String sDate = new Long(date).toString();
		
		currentNum++;
		
		String genID = sDate + new Long(currentNum).toString();
				
		this.currentId = genID;
		
		return genID;
	}

}
